home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 November / Ahoy_Magazine_87-11_1987_Double_L.d64 / Random Order 1 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  411b  |  17 lines

  1. 1 rem ==================================
  2. 2 rem    commodares problem #43-3 :
  3. 3 rem     random order
  4. 4 rem    solution by
  5. 5 rem     jim speers
  6. 6 rem ==================================
  7. 100 input"[147]lower limit";l:l=int(l+.5)
  8. 110 input"upper limit";h:h=int(h+.5)
  9. 120 if h<l then t=h : h=l : l=t
  10. 130 w=h-l+1 : dim n(w-1) : for i=1 to w
  11. 140 x=int(rnd(1)*w)
  12. 150 if n(x)=0 then 180
  13. 160 x=x+1 : if x=w then x=0
  14. 170 goto 150
  15. 180 n(x)=1 : print x+l;
  16. 190 next i
  17.